
export const sendEmail=(self, tiyData,addressBook)=>{
  tiyData.tParam.email.selectedUsers=[];
  let user={
    contactEmail:addressBook.virtualName,
    encodeName:addressBook.encodeName,
  };
  tiyData.tParam.email.selectedUsers.push(user);
  self.$refs.SendEmail.email.title='';
  self.$refs.SendEmail.email.content='';
  tiyData.tStatus.replayEmail.isShowing=true;
}

export const getMessageStatus = (self, tiyData,userId) => {
  let params = {userId: userId};
  tiyData.tData.messageStatus = {};
  self.$Spin.show();
  self.$apiChat.queryMessageStatus(params).then(response => {
    if(response.success) {
      if(response.result!=null) {
        let messageStatus = response.result;
        self.employeeName=messageStatus.employeeName;
      }
    }else{
      self.$Message.error(response.errorMessage);
    }
    self.$Spin.hide();
  });
}

//查询列表
export const webList = (self, tiyData) => {
  self.$Spin.show();
  self.$ySpliceAll(tiyData.tData.addressBookList);

  let param = {
    "pageSize": tiyData.tPage.stepNumber,
    "pageNum": tiyData.tPage.currentPage,
    "encodeName": tiyData.tParam.encodeName,
    "employeeName": tiyData.tParam.employeeName,
    "tag": tiyData.tParam.tag,
    "isAll":self.$authority(self.tRole.COMMON_1_100),
  };

  self.$apiEmail.queryAddressBooks(param).then(function (response) {
    if(response.success){
      let addressBook = response.result;
      tiyData.tPage.total = addressBook.total;
      tiyData.tPage.stepNumber = addressBook.pageSize;
      tiyData.tData.addressBookList=[...addressBook.list];
    }else{
      self.$Message.error(response.errorMessage);
    }
    self.$Spin.hide();
  });
};
